; Mika

; Constants -------------------------

; Overrides -------------------------

[TextureOverrideMikaPosition]
hash = 1876e82e
vb0 = ResourceMikaPosition

[TextureOverrideMikaBlend]
hash = b8a027a1
vb1 = ResourceMikaBlend
handling = skip
draw = 32189,0 

[TextureOverrideMikaTexcoord]
hash = 285f6696
vb1 = ResourceMikaTexcoord

[TextureOverrideMikaVertexLimitRaise]
hash = 9d5bb5ff

[TextureOverrideMikaIB]
hash = 79a263de
handling = skip
drawindexed = auto

[TextureOverrideMikaHead]
hash = 79a263de
match_first_index = 0
ib = ResourceMikaHeadIB
ps-t0 = ResourceMikaHeadDiffuse
ps-t1 = ResourceMikaHeadLightMap
ps-t2 = ResourceMikaHeadShadow

$CharacterIB = 1
ResourceRefHeadDiffuse = reference ps-t1
ResourceRefHeadLightMap = reference ps-t2

[TextureOverrideMikaBody]
hash = 79a263de
match_first_index = 21072
ib = ResourceMikaBodyIB
ps-t0 = ResourceMikaBodyDiffuse
ps-t1 = ResourceMikaBodyLightMap
ps-t2 = ResourceMikaBodyShadow

$CharacterIB = 2
ResourceRefBodyDiffuse = reference ps-t1
ResourceRefBodyLightMap = reference ps-t2

[TextureOverrideMikaDress]
hash = 79a263de
match_first_index = 52122
ib = ResourceMikaDressIB
ps-t0 = ResourceMikaDressDiffuse
ps-t1 = ResourceMikaDressLightMap

$CharacterIB = 3
ResourceRefDressDiffuse = reference ps-t1
ResourceRefDressLightMap = reference ps-t2

[TextureOverrideMikaFaceHeadDiffuse]
hash = 0026026f
ps-t0 = ResourceMikaFaceHeadDiffuse


; CommandList -----------------------

; Resources -------------------------

[ResourceMikaPosition]
type = Buffer
stride = 40
filename = MikaPosition.buf

[ResourceMikaBlend]
type = Buffer
stride = 32
filename = MikaBlend.buf

[ResourceMikaTexcoord]
type = Buffer
stride = 20
filename = MikaTexcoord.buf

[ResourceMikaHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = MikaHead.ib

[ResourceMikaBodyIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = MikaBody.ib

[ResourceMikaDressIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = MikaDress.ib

[ResourceMikaHeadDiffuse]
filename = MikaHeadDiffuse.dds

[ResourceMikaHeadLightMap]
filename = MikaHeadLightMap.dds

[ResourceMikaHeadShadow]
filename = MikaHeadShadow.dds

[ResourceMikaBodyDiffuse]
filename = MikaBodyDiffuse.dds

[ResourceMikaBodyLightMap]
filename = MikaBodyLightMap.dds

[ResourceMikaBodyShadow]
filename = MikaBodyShadow.dds

[ResourceMikaDressDiffuse]
filename = MikaDressDiffuse.dds

[ResourceMikaDressLightMap]
filename = MikaDressLightMap.dds

[ResourceMikaFaceHeadDiffuse]
filename = MikaFaceHeadDiffuse.dds


; .ini generated by GIMI (Genshin-Impact-Model-Importer)
; If you have any issues or find any bugs, please open a ticket at https://github.com/SilentNightSound/GI-Model-Importer/issues or contact SilentNightSound#7430 on discord

; Version 1.0.0 AGMG Tool Developer Version 3 Shader Fixer


; Generated shader fix for 3.0+ GIMI importer characters. Please contact the tool developers at https://discord.gg/agmg if you have any questions.
; Variables -----------------------
[Constants]
global $CharacterIB
;0=none, 1=head, 2=body, 3=dress, 4=extra, etc.
[Present]
post $CharacterIB = 0
[ResourceRefHeadDiffuse]
[ResourceRefHeadLightMap]
[ResourceRefBodyDiffuse]
[ResourceRefBodyLightMap]
[ResourceRefDressDiffuse]
[ResourceRefDressLightMap]
[ResourceRefExtraDiffuse]
[ResourceRefExtraLightMap]
; ShaderOverride ---------------------------
[ShaderRegexCharReflection]
shader_model = ps_5_0
run = CommandListReflectionTexture
[ShaderRegexCharReflection.pattern]
mul r\d+\.\w+, r\d+\.\w+,[^.]*\.\w+\n
mad o\d+\.\w+, r\d+\.\w+, cb\d+\[\d+\]\.\w+, r\d+\.\w+\n
mov o\d+\.\w+, l\(\d+\.\d+\)\n
[ShaderRegexCharOutline]
shader_model = ps_5_0
run = CommandListOutline
[ShaderRegexCharOutline.pattern]
mov o\d+\.\w+, l\(\d+\)\n
mov o\d+\.\w+, r\d+\.\w+\n
mov o\d+\.\w+, l\(\d+\.\d+\)
; OPTIONAL: If regex match breaks, use a [ShaderOverride] command matching shader hash for reflection then use "run = CommandListOutline" under the command
; CommandList -------------------------
[CommandListReflectionTexture]
if $CharacterIB != 0
    if $CharacterIB == 1
        ps-t0 = copy ResourceRefHeadDiffuse
    else if $CharacterIB == 2
        ps-t0 = copy ResourceRefBodyDiffuse
    else if $CharacterIB == 3
        ps-t0 = copy ResourceRefDressDiffuse
    else if $CharacterIB == 4
        ps-t0 = copy ResourceRefExtraDiffuse    
    endif
drawindexed=auto
$CharacterIB = 0
endif
[CommandListOutline]
if $CharacterIB != 0
    if $CharacterIB == 1
        ps-t1 = copy ResourceRefHeadLightMap
    else if $CharacterIB == 2
        ps-t1 = copy ResourceRefBodyLightMap
    else if $CharacterIB == 3
        ps-t1 = copy ResourceRefDressLightMap
    else if $CharacterIB == 4
        ps-t1 = copy ResourceRefExtraLightMap
    endif
drawindexed=auto
$CharacterIB = 0
endif
